package cn.drenal.capcap.controller.forum;

import cn.dev33.satoken.annotation.SaIgnore;
import cn.drenal.capcap.common.Response;
import cn.drenal.capcap.entity.vo.RecommendedArtworkVO;
import cn.drenal.capcap.service.RecommendedArtworkService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 前台精品推荐控制器
 */
@RestController
@RequestMapping("/forum/recommend")
@RequiredArgsConstructor
public class ForumRecommendController {

    private final RecommendedArtworkService recommendedArtworkService;

    /**
     * 获取最新推荐作品
     *
     * @param limit 获取数量，默认为5
     * @return 推荐作品列表
     */
    @SaIgnore
    @GetMapping("/recommended-artworks")
    public Response<List<RecommendedArtworkVO>> getRecommendedArtworks(
            @RequestParam(defaultValue = "5") Integer limit) {
        return Response.success(recommendedArtworkService.getLatestRecommendedArtworks(limit));
    }
}
